package data

import (
	"helloworld/app/user/service/internal/conf"

	"github.com/go-kratos/kratos/v2/log"
	amqp "github.com/rabbitmq/amqp091-go"
)

func NewMq(conf *conf.Data, loggers log.Logger) *amqp.Connection {
	log := log.NewHelper(log.With(loggers, "module", "user-service/data/mq"))
	conn, err := amqp.Dial(conf.Mq.Addr)

	if err != nil {
		log.Fatalf("failed opening connection to mongo: %v", err)
	}

	return conn
}
